package com.kclm.pojo;

/**
 * @Author : lvhx
 * @Date: 2025/11/4 10:00
 * @Description:
 */
public class Husband {
    private String name;
    private Wife wife;

    public Husband(String name, Wife wife) {
        this.name = name;
        this.wife = wife;
    }

    public String getName() {
        return name;
    }

//    public void setName(String name) {
//        this.name = name;
//    }
//
//    public void setWife(Wife wife) {
//        this.wife = wife;
//    }

    @Override
    public String toString() {
        //toString 注意还能直接输出wife  输出wife的name  要不然会出现递归导致内存溢出
        return "Husband{" +
                "name='" + name + '\'' +
                ", wife=" + wife.getName() +
                '}';
    }
}
